import http from '@/plugins/axios/index.js';

// 教师信息查询和获取教师推荐课程
export const getLectureInfo = (params) => {
  return http(`/lt-order/logonless/select_PcLecturer_byUserId.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 根据课程id查询课程的详细信息 （视频等pc）---课程介绍也写在这里面了
export const getLessonInfo = (params) => {
  return http(
    `/lt-order/lessonInfo/logonless/selelctLessonInfoForPc.do`,
    params,
    {
      method: 'GET'
    }
  ).then((res) => res);
};

// 是否收藏课程
export const hasCollectLesson = (params) => {
  return http(`/lt-order/collect_lesson.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 是否点赞课程
export const hasPraiseLesson = (params) => {
  return http(`/lt-order/get_like_lesson.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 评论标准-平均评分
export const getCommentStand = (params) => {
  return http(`lt-order/logonless/selectAverageScore.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 分页查询评论接口
export const getCommentListByPage = (params) => {
  return http(`lt-order/logonless/selectLessonCommentByPage.do`, params, {
    method: 'POST'
  }).then((res) => res);
};

// 推荐课程
export const getRecommendLesson = (params) => {
  return http(`/lt-order/logonless/select_reco_lessons.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 学员动态
export const getStudentBehavior = (params) => {
  return http(`/lt-order/logonless/query_student_dynamics.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 分节课程查询
export const getLessonCatalog = (params) => {
  return http(`/lt-order/logonless/select_PcSubLesson_byLessonId.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 用vid换取playauth
export const getPlayAuth = (params) => {
  return http(`/lt-order/logonless/select_video_token.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 单个分节课程视频查询---第一个视频
export const getLessonVideoOnFirst = (params) => {
  return http(`/lt-order/logonless/select_subLesson_free_video.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 单个分节课程视频查询
export const getLessonVideo = (params) => {
  return http(`/lt-order/select_subLesson_video.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 单个分节课程视频查询
export const getTeacherRecommend = (params) => {
  return http(`/lt-order/logonless/query_lecturer_recommend.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 提交一份评论
export const addComment = (params) => {
  return http(`/lt-order/addLessonComment.do`, params, {
    method: 'POST'
  }).then((res) => res);
};

// 点赞评论
export const praiseComment = (params) => {
  return http(`/lt-order/addCommentLike.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 删除评论
export const deleteMyComment = (params) => {
  return http(`/lt-order/pcDeleteLessonComment.do`, params, {
    method: 'GET'
  }).then((res) => res);
};

// 多条件课程查询
export const getLogonless = params => {
  return http(`/lt-order/logonless/select_lesson_byname_page.do`, params, {
    method: 'POST'
  }).then(res => res);
};

